<?php

/**
 * Cuota form base class.
 *
 * @method Cuota getObject() Returns the current form's model object
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCuotaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'nominal'           => new sfWidgetFormInputText(),
      'fecha_pago'        => new sfWidgetFormDateTime(),
      'vehiculo_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Vehiculo'), 'add_empty' => false)),
      'periodo_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Periodo'), 'add_empty' => false)),
      'inmobiliario_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Inmobiliario'), 'add_empty' => false)),
      'seguridad_higiene' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SeguridadHigiene'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nominal'           => new sfValidatorNumber(),
      'fecha_pago'        => new sfValidatorDateTime(array('required' => false)),
      'vehiculo_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Vehiculo'))),
      'periodo_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Periodo'))),
      'inmobiliario_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Inmobiliario'))),
      'seguridad_higiene' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SeguridadHigiene'))),
    ));

    $this->widgetSchema->setNameFormat('cuota[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Cuota';
  }

}
